﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ERP.Team.ProductionSystem;
using Volo.Abp.Application.Services;
using ERP.Common.DTO;

namespace ERP.ERPSystem.ProductionSystem.MaterialTypes
{
    /// <summary>
    /// 物料产品分类服务接口
    /// </summary>
    public interface IMaterialTypeService : IApplicationService
    {
        /// <summary>
        /// 分页查询分类
        /// </summary>
        /// <param name="keyword">分类名称关键字</param>
        /// <param name="isEnabled">是否启用（null 表示全部）</param>
        /// <param name="page">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>分页结果</returns>
        Task<PagedResult<MaterialType>> GetPagedMaterialTypesAsync(string keyword = null, bool? isEnabled = null, int page = 1, int pageSize = 10);

        /// <summary>
        /// 根据 ID 获取分类
        /// </summary>
        /// <param name="id">分类 ID</param>
        /// <returns>分类实体</returns>
        Task<MaterialType> GetByIdAsync(int id);

        /// <summary>
        /// 新增或修改分类
        /// </summary>
        /// <param name="entity">分类实体</param>
        /// <returns>操作是否成功</returns>
        Task<bool> SaveAsync(MaterialTypeAddDTO entity);

        /// <summary>
        /// 删除分类（递归删除子分类）
        /// </summary>
        /// <param name="id">分类 ID</param>
        /// <returns>操作是否成功</returns>
        Task<bool> DeleteAsync(int id);

        /// <summary>
        /// 分页查询分类
        /// </summary>
        /// <param name="keyword">分类名称关键字</param>
        /// <param name="isEnabled">是否启用（null 表示全部）</param>
        /// <param name="page">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>分页结果</returns>
        Task<List<MaterialType>> GetPagedListAsync(string keyword = null, bool? isEnabled = null);

        /// <summary>
        /// 选择要添加的父级
        /// </summary>
        /// <returns>返回数据</returns>
        Task<List<MaterialType>> GetMaterialTypes();

        /// <summary>
        /// 获取分类树形结构（递归构建）
        /// </summary>
        /// <returns>分类树形列表</returns>
        Task<List<MaterialTypeDTO>> GetTreeAsync();


        /// <summary>
        /// 分页查询分类
        /// </summary>
        /// <param name="keyword">分类名称关键字</param>
        /// <param name="isEnabled">是否启用（null 表示全部）</param>
        /// <param name="page">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>分页结果</returns>
       // Task<List<MaterialType>> GetPagedListAsync(string keyword = null, bool? isEnabled = null);


        //--------------------------------------------------------------------------

        /// <summary>
        /// 获取分类树形结构（递归构建）
        /// </summary>
        /// <returns>分类树形列表</returns>
        Task<List<MaterialType>> GetTreeAsyncgrx();

        /// <summary>
        /// 分页查询分类
        /// </summary>
        /// <param name="keyword">分类名称关键字</param>
        /// <param name="isEnabled">是否启用（null 表示全部）</param>
        /// <param name="page">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns>分页结果</returns>
        Task<PagedResult<MaterialType>> GetPagedListAsyncgrx(string keyword = null, bool? isEnabled = null, int page = 1, int pageSize = 10);

        /// <summary>
        /// 根据 ID 获取分类
        /// </summary>
        /// <param name="id">分类 ID</param>
        /// <returns>分类实体</returns>
        Task<MaterialType> GetByIdAsyncgrx(int id);

        /// <summary>
        /// 新增或修改分类
        /// </summary>
        /// <param name="entity">分类实体</param>
        /// <returns>操作是否成功</returns>
        Task<bool> SaveAsyncgrx(MaterialTypeAddDTO entity);

        /// <summary>
        /// 删除分类（递归删除子分类）
        /// </summary>
        /// <param name="id">分类 ID</param>
        /// <returns>操作是否成功</returns>
        Task<bool> DeleteAsyncgrx(int id);
    }
}
